using Unity.Entities;
using UnityEngine;

namespace DOTS.DOD.LESSON4
{
    public class WaveCubeAuthoring : MonoSingleton<WaveCubeAuthoring>
    {
        public GameObject CubeArchetype;
        [Range(10, 100)] public int RadiusX;
        [Range(10, 100)] public int RadiusZ;

        class Baker : Baker<WaveCubeAuthoring>
        {
            public override void Bake(WaveCubeAuthoring authoring)
            {
                var entity = GetEntity(TransformUsageFlags.None);
                AddComponent(entity, new WaveCubeGenerator()
                {
                    CubeProtoType = GetEntity(authoring.CubeArchetype, TransformUsageFlags.Dynamic),
                    RadiusX = authoring.RadiusX,
                    RadiusZ = authoring.RadiusZ,
                });
            }
        }
    }
}